import pandas as pd
import numpy as np

data =np.arange(12).reshape(3,4)
df =pd.DataFrame(data,index=['a','b','c'],columns=['dd','ee','ff','gg'])
print(df)

df.sort_index(axis=0)  #行排序
print(df)

df.sort_index(axis=1)  #列排序
print(df)

df.sort_values(by='gg')#按’cc’列的数据进行排序
print(df)